/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package configuraciones;

import org.cip.esymons.general.bc.*;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.general.be.Permiso;

/**
 * @author Lizardo Rios
 */
public class PermisoDelegate {
    public PermisoFacadeLocal local;

    public PermisoDelegate() {
        local=lookupPermisoFacade();
    }

    public void create(Permiso permiso) throws Exception {
        local.create(permiso);
    }

    public void edit(Permiso permiso) throws Exception {
        local.edit(permiso);
    }

    public void remove(Permiso permiso) throws Exception {
        local.remove(permiso);
    }

    public Permiso find(Object id) throws Exception {
        return local.find(id);
    }

    public List<Permiso> findAll() throws Exception {
        return local.findAll();
    }

    private PermisoFacadeLocal lookupPermisoFacade() {
        try {
            Context c = new InitialContext();
            return (PermisoFacadeLocal) c.lookup("java:comp/env/PermisoFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
    
}
